#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <netdb.h>
#include <map>
#include <string>
#include <assert.h>
#include <stdint.h>
#include <pthread.h>
#include <signal.h>
#include <sys/epoll.h>


#define ERR_EXIT(msg) do { perror(msg); exit(1); } while(0)
typedef std::map<std::string, std::string> Args;


int64_t now();
struct sockaddr_in resolve(const char* hostname, int port);
int readn(int fd, char* buf, int n);
int writen(int fd, char* buf, int n);
std::map<std::string, std::string> parsecmdline(int argc, char* argv[]);
